//
//  WalletDetailViewController.m
//  atXiaoGeBClient
//
//  Created by Linyu Niu on 20/04/2018.
//  Copyright © 2018 Linyu Niu. All rights reserved.
//

#import "WalletDetailViewController.h"

@interface WalletDetailViewController ()<UITableViewDelegate,UITableViewDataSource>
{
    UITableView * detailTableView;
    NSArray * dataList;
}
@end

@implementation WalletDetailViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    __weak WalletDetailViewController * weakSelf = self;
    UIView * navView = [[CTMediator sharedInstance] navgationHeadViewInTargetView:self.view params:[NSDictionary dictionaryWithObjectsAndKeys:@"账户明细",@"title", nil] leftAction:^(UIButton * sender){
        [weakSelf.navigationController popViewControllerAnimated:YES];
    } rightAction:^(UIButton * sender){
        
    }];
    detailTableView = [self addTableViewInView:self.view frame:CGRectMake(0, navView.frame.origin.y + navView.frame.size.height, self.view.frame.size.width, self.view.frame.size.height - navView.frame.origin.y - navView.frame.size.height) delegateAndDataSource:self];
    
    [[CTMediator sharedInstance] getWalletDetail:@"" block:^(NSDictionary * dic){
        
    }];
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    ElementTableViewCell * cell = (ElementTableViewCell *)[self tableView:tableView cellForRowAtIndexPath:indexPath];
    
    return cell.cellHeight;
    
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    ElementTableViewCell * cell = [[ElementTableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:nil];
    
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    
    UILabel * namelabel = [[UILabel alloc] init];
    namelabel.frame = CGRectMake(15, 15, tableView.frame.size.width - 30, 25);
    
    namelabel.font = [UIFont systemFontOfSize:14];
    namelabel.textColor = [UIColor colorWithRed:51.0/255.0 green:51.0/255.0 blue:51.0/255.0 alpha:1.0];
    [cell addSubview:namelabel];
    
    
    UILabel * timeLabel = [[UILabel alloc] init];
    timeLabel.frame = CGRectMake(namelabel.frame.origin.x, namelabel.frame.size.height + namelabel.frame.origin.y, namelabel.frame.size.width, namelabel.frame.size.height);
    
    timeLabel.font = [UIFont systemFontOfSize:13];
    timeLabel.textColor = [UIColor colorWithRed:153.0/255.0 green:153.0/255.0 blue:153.0/255.0 alpha:1.0];
    [cell addSubview:timeLabel];
    
    
    cell.cellHeight = timeLabel.frame.size.height + timeLabel.frame.origin.y + namelabel.frame.origin.y;
    
    UIView * lineView = [[UIView alloc]initWithFrame:CGRectMake(0, cell.cellHeight - 0.5, tableView.frame.size.width, 0.5)];
    lineView.backgroundColor = UIColorFromRGB(0xE9E9E9);
    [cell addSubview:lineView];
    
    
    UILabel * valueLabel = [[UILabel alloc] init];
    valueLabel.frame = CGRectMake(0, 0, tableView.frame.size.width - 30, cell.cellHeight);
    valueLabel.textAlignment = NSTextAlignmentRight;
    valueLabel.font = [UIFont systemFontOfSize:15];
    valueLabel.textColor = [UIColor colorWithRed:32.0/255.0 green:198.0/255.0 blue:122.0/255.0 alpha:1.0];
    [cell addSubview:valueLabel];
    
    
#if kDevelopment
    namelabel.text = @"订单小费";
    timeLabel.text = @"08-28 10：00";
    valueLabel.text = @"+9";
#endif
    
    return cell;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
#if kDevelopment
    return 10;
#endif
    
    return [dataList count];
}
@end
